# Maintainer: Sergej Pupykin <pupykin.s+arch@gmail.com>
# Contributor: Jeremie Dimino <jeremie@dimino.org>
# Contributor: bender02 at gmx dot com

pkgname=lrzsz
pkgver=0.12.20
pkgrel=8
pkgdesc="xmodem, ymodem and zmodem file transfer protocols"
url="https://www.ohse.de/uwe/software/lrzsz.html"
license=('GPL2')
arch=('loong64' 'x86_64')
source=(https://www.ohse.de/uwe/releases/$pkgname-$pkgver.tar.gz
	https://src.fedoraproject.org/rpms/lrzsz/raw/rawhide/f/lrzsz-0.12.20.patch
	lrzsz.patch)
sha512sums=('9bce64036f1f1c65f5910f19802aecaf3dc5ffeab0feeca10fa8d2fe1b83e212391cce23056d22fd0eda52df89e12ede68eb5d22ffcf22f935910d2af7399f12'
            '71c527712b0909b77e7d68dedb816b3229d53ef39e76f617661640d05e20ade8129347ee2801f636705abca4cf1b591963e7067d26e7e822e01e6cfa8cea8d8e'
            '4912ec15bb1bd63b2af0c74970daf3023bdc441ad3f5f3c95b3bf46b5f11e21022dcfe5c80151ffc99ae1fd3df9b7fe01f44d00a1d8f1a35e04f68e7f3f38430')

prepare() {
  cd "$srcdir"/$pkgname-$pkgver
  patch -Np1 -i ../lrzsz.patch
  patch -Np1 -i ../lrzsz-0.12.20.patch
  sed -i 's|${CC-cc} -E|${CC-cc} -O2 -E|g' configure
}

build() {
  cd "$srcdir"/$pkgname-$pkgver
  # Rename file so they can be used with minicom
  ./configure --prefix=/usr --mandir=/usr/share/man \
	--program-transform-name=s/l//
  make -j1
}

package() {
  cd "$srcdir"/$pkgname-$pkgver
  make -j1 DESTDIR="$pkgdir" install
}
